package com.lei.yohuo001java.adapter;

import android.graphics.Color;
import android.graphics.Typeface;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lei.yohuo001java.R;
import com.lei.yohuo001java.bean.StringBean;
import java.util.List;

/**
 * @ProjectName : YoHuo001Java
 * @Author : 雷金泷
 * @Time : 2020/12/18 9:56
 * @Description : 文件描述
 */
public class MyStringAdapter extends BaseQuickAdapter<StringBean, BaseViewHolder> {
    public MyStringAdapter(int layoutResId, @Nullable List<StringBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, StringBean item) {
        helper.setText(R.id.tv1_string,item.getTitle()+"");
        TextView tv1 = helper.getView(R.id.tv1_string);
        View view = helper.getView(R.id.view_string);

        if (item.isChecked()){
            view.setVisibility(View.VISIBLE);
            helper.setTextColor(R.id.tv1_string, Color.RED);
            tv1.setTextSize(20);
            tv1.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
        }else {
            view.setVisibility(View.INVISIBLE);
            helper.setTextColor(R.id.tv1_string,Color.BLACK);
            tv1.setTextSize(18);
            tv1.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
        }
    }
}
